* to be run after 1_Table_2\7_estimation_sample_and_variables.do
set more off  
clear
version 13


cap log close	
local gruppo = 1
	
log  using  .../AA_9_`gruppo'_05Sep2020.smcl, replace

version 13	
use .../sample_estimation_1_03Sept2020.dta, clear

bys id: gen firstobsid= _n==1
tab firstobsid
bys sedum: tab firstobsid

expand 10 if  pweight == 10

su durvar
bys sedum: su durvar

sum age reg*  year_g* convexity_naer netincdiff , sep(0)

bys sedum: sum age reg* year_g* convexity_naer netincdiff , sep(0)

bys sedum year: sum age female reg*  year_g* educ_1 educ_2 educ_3 convexity_naer netincdiff , sep(0)

su female educ_1 educ_2 educ_3 if firstobsid==1, sep(0)   
bys sedum: su female educ_1 educ_2 educ_3  if firstobsid==1, sep(0)


bys id: keep if _n==1
su female educ_1 educ_2 educ_3, sep(0)
bys sedum: su female educ_1 educ_2 educ_3, sep(0)

clear
* ANCOVA results, footnote 26
use .../sample_estimation_1_03Sept2020.dta, clear

bys id: gen firstobsid= _n==1
tab firstobsid
bys sedum: tab firstobsid

expand 10 if  pweight == 10


gen ln_h_hat_wage=ln(h_hat_wage) 
gen ln_h_hat_naer=ln(h_hat_naer) 

gen neweduc=1*(1-educ_2-educ_3)+ 2*educ_2+ 3*educ_3
tab neweduc

gen newregion=(1-region_2-region_3-region_4-region_5)+2*region_2+3*region_3+4*region_4+5*region_5
tab newregion


*** without splitting by occu
anova netincdiff c.convexity_naer female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress

anova convexity_naer c.netincdiff female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress

*** including sedum
anova netincdiff c.convexity_naer sedum female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress

anova convexity_naer c.netincdiff sedum female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress



bys sedum: anova netincdiff female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress

bys sedum: anova convexity_diff  female neweduc newregion kids married head c.age c.mills_naer c. mills_wage c.ln_h_hat_naer c.ln_h_hat_wage i.year
regress



log close








log close
